#!/usr/bin/env python
#-------------------------------python-----------------------tarta.py--#
#                                                                      #
#                           Demo di tarta                              #
#                                                                      #
#--Daniele Zambelli----------------------------------------------2003--#

from random import random, randrange
from pyturtle import Turtle 

# init
tina=Turtle()

def coloraacaso():
  '''Assegna a Tartaruga un colore con componenti RGB casuali'''
  tina.setcolor(random(), random(), random())

def test1():
  tina.tracer(20)
  coloraacaso()
  tina.setwidth(5)
  for i in range(180):
    tina.left(1)
    tina.forward(2)
    tina.left(1)

def test2():
  tina.left(60)
  tina.forward(100)
  tina.back(100)
  tina.setwidth(50)
  tina.up()
  tina.forward(50)
  d=0
  for i in range(1000000):
    d+=1
  tina.setwidth(1)
  tina.setcolor('red')
  for i in range(1000000):
    d+=1
  tina.down()
  tina.back(50)
  for i in range(1000000):
    d+=1
  tina.right(60)
  tina.forward(100)

def main():
  global tina
  test1()
  tina=Turtle()
  test2()

if __name__ == "__main__": main()
